package com.lyc.dao;

import com.lyc.dao.imp.SportsmanInfoDAOImpl;
import com.lyc.entity.SportsmanInfo;
import org.junit.jupiter.api.Test;

import java.math.BigDecimal;
import java.sql.SQLException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @Program: medal
 * @Author: YC
 * @Date: 2022/5/5 19:29
 */

public class SportsmanInfoDAOTest {
    private SportsmanInfoDAO dao = new SportsmanInfoDAOImpl();
    SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd");
    @Test
    public void insert() throws SQLException{
        dao.insert(new SportsmanInfo(1003,"cn","谷爱凌",new Date(),180,new BigDecimal(120.32)," ","123",0));
    }

    @Test
    public void select() throws SQLException{
        System.out.println(dao.selectById(1001));
        System.out.println(dao.select(0,3));
    }

    @Test
    public void updateById() throws SQLException{
        try{
            Date date = sf.parse("2019-07-22");
            dao.updateById(new SportsmanInfo(1001,"cn","谷爱凌",date,180,new BigDecimal(120.32),"","123",1));
        }catch(Exception e){
            e.printStackTrace();
        }
    }

    @Test
    public void delete() throws SQLException{
        dao.deleteById(1002);

    }


}
